package com.zt.springcloud.service.Impl;

import com.zt.springcloud.RemoteProductService;
import com.zt.springcloud.entity.Product;
import com.zt.springcloud.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Iterator;
import java.util.Set;

/**
 * @author RedReins
 * @version 1.0
 * @description: TODO
 * @date 2021/9/4 14:54
 */
@Component
@SuppressWarnings("all")
public class FoodServiceImpl implements FoodService {
    @Autowired
    private RemoteProductService remoteProductService;

    @Override
    public Set<Product> getAllItem() {
        Set<Product> allFoodItem = remoteProductService.getAllFoodItem();
        Iterator<Product> iterator = allFoodItem.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next().getImageUrl());
        }
        return remoteProductService.getAllFoodItem();
    }

    @Override
    public Product getItemInfo(Long productId) {
        return remoteProductService.getItemInfo(productId);
    }


}
